<?php
namespace app\member\controller;

class Index extends Common
{
    public function index()
    {	
        return $this->fetch();
    }

    //个人中心
    public function personal_center()
    {
    	if(request()->isAjax()){
    		$passwd = input('passwd');

    		if(!empty($passwd)){
    			$data['password'] = md5($passwd);
    		}

    		$result = db('admin_member')->where(['id'=>$this->info['id']])->update($data);
    		if(!$result)return $this->error('修改失败!');
    		$this->success('修改成功');
    	}

    	$info = db('admin_member')->where(['id'=>$this->info['id']])->find();
    	$this->assign('member',$info);
    	$this->assign('img_path',IMG_PATH);
    	return $this->fetch();
    }
}
